JavaScript

A5.u.elementtoggle Method

Syntax

A5.u.element.toggle(element[,animation])

Arguments

elementelementstring

A pointer to a DOM element or the ID of an element.

animationobject

Animation settings.

typestring

Animation type. Can be one of the following properties: 'none', 'fade', 'slide', 'blind', 'clip', 'drop', 'explode', 'fold', 'puff', 'scale', 'size', or 'pulsate'.

durationnumber

The duration of the animation in milliseconds.

onCompletefunction

Function to call when the show/hide is complete.

Description

Toggle the display of an element.

Discussion

Animation can be specified by passing in animation settings. Animation uses jQuery, if the jQuery library is not available, a plain show/hide will be done. If different animation wants to be used for show and hide, the animation settings object can consist of two properties "show" and "hide" which should have the standard animation settings in them.

Example

// assume "ele" is a pointer to an element to be shown/hidden
var animate = {
	show: {
		type: 'slide', 
		duration: 300
	},
	hide: {
		type: 'fade', 
		duration: 300
	}
};
A5.u.element.toggle(ele,animate);